package com.libraries.helper;

import android.util.Log;



public class Logger {
	private static final int LOGLEVEL=1;
	private static final String TAG="Logger";
	private static StringBuffer logBuffer=new StringBuffer();
	
	public static void log(Object cls,Object method,Object... what){
		logBuffer.setLength(0);
		if (cls==null) 
			cls="nothing";
		else if (cls instanceof String) {
			cls=cls.toString();
		}
		else {
			cls=cls.getClass().getSimpleName();
		}
		if (method==null) 
			method="nothing";
		if(what==null)
			logBuffer.append("nothing");
		else{
			for (Object object : what) {
				logBuffer.append(object+"【】");
			}
		}
		switch (LOGLEVEL) {
			case 0:
				Log.v(TAG+"【"+cls.toString()+"："+method.toString()+"】", "【】"+logBuffer.toString());
				break;
			case 1:
				Log.d(TAG+"【"+cls.toString()+"："+method.toString()+"】", "【】"+logBuffer.toString());
				break;
			case 2:
				Log.i(TAG+"【"+cls.toString()+"："+method.toString()+"】", "【】"+logBuffer.toString());
				break;
			case 3:
				Log.w(TAG+"【"+cls.toString()+"："+method.toString()+"】", "【】"+logBuffer.toString());
				break;
			default:
				Log.e(TAG+"【"+cls.toString()+"："+method.toString()+"】", "【】"+logBuffer.toString());
		}
	}
}

